/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Principal;

import Data.Errores;
import Data.ListaError;
import Data.Simbolo;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Rey
 */
public class VentanaErrores extends javax.swing.JFrame {
    
    ListaError listaErrores;

    /**
     * Creates new form VentanaErrores
     */
    public VentanaErrores() {
        initComponents();
    }

    public VentanaErrores(ListaError listaErrores) {
        this.listaErrores = listaErrores;
        initComponents();
        CargarErrores();
    }
    
    private void CargarErrores()
    {
        String [] titulos= {"No.","Linea","Columna","Error","Tipo","Descripcion"};
        DefaultTableModel dtm = new DefaultTableModel(null,titulos);
        int cont = 1;

        for(Errores error : listaErrores.getLista()) {           
            
            Object data[] ={cont,error.getLinea(),error.getColumna(),error.getError(),error.getTipo(),error.getDescripcion()};
            dtm.addRow(data);
            cont++;
        }
        
        tablaErrores.setModel(dtm);
    }
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        tablaErrores = new javax.swing.JTable();

        setTitle("Ventana de Errores");

        tablaErrores.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tablaErrores);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1017, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tablaErrores;
    // End of variables declaration//GEN-END:variables
}
